package com.snopy.io.characterstream;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

/**
 * @author snopy
 * @version 1.0.0
 * @classname DemoCharacterStream
 * @description
 * @email 77912204@qq.com
 * @date 2022/11/15 19:41
 */
public class DemoCharacterStream {
    public static void main(String[] args) {
        FileReader in = null;
        FileWriter out = null;
        try {
            in = new FileReader("F:\\workspaceA\\Sonata\\Sonata_test\\src\\main\\resources\\abc.txt");
            out = new FileWriter("./bbb.txt");
            int b = 0;
            while ((b = in.read()) != -1){
                out.write(b);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }finally {
            if (in !=null){
                try {
                    in.close();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            if (out != null){
                try {
                    out.close();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        }

    }
}
